<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib prefix="paasfn"
    uri="http://www.glodon.com/paas/jsp/functions"%>
<%
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath()+"/";  
%>
<base href="<%=basePath%>" />

<!-- ============== 添加活动   ==============  -->
<!-- style="display: none" -->
<div id="div-showActivityDefinition-form">
    <form id="activityDefinitionForm"
        action="/activity/activityDefinition/save" method="post">
        <table>
            <tr>
                <td>activityType</td>
                <td><input id="activityType" name="activityType"
                    readonly="readonly" placeholder="activityType"
                    value="${item.activityType}" class="readonly"></td>
            </tr>
            <tr>
                <td>appId</td>
                <td><input id="appId" name="appId" readonly="readonly"
                    placeholder="appId" value="${item.appId}" class="readonly"></td>
            </tr>
            <tr>
                <td>modelId</td>
                <td><input id="modelId" name="modelId" value="${item.modelId}"
                    onkeyup="javascript:changeType('modelId');" maxlength="6">(应用自定义)</td>
            </tr>
            <tr>
                <td>编号</td>
                <td><input id="type" name="type" placeholder="type"
                    value="${item.type}" onkeyup="javascript:changeType('type');"
                    maxlength="6">(模块内唯一编号)</td>
            </tr>
            <tr>
                <td>活动名</td>
                <td><input name="actionNameEn" placeholder="如:fileUpload"
                    value="${item.actionNameEn}">(如:fileUpload)</td>
            </tr>
            <tr>
                <td>中文名</td>
                <td><input name="actionNameCn" placeholder="如:文件上传"
                    value="${item.actionNameCn}">(如:文件上传)</td>
            </tr>
            <tr>
                <td>保留时间</td>
                <td><input name="period" placeholder="如:365"
                    value="${item.period}">(单位天，0表示永远保留)</td>
            </tr>
            <tr>
                <td>状态</td>
                <td>
                    <select name="status">
                        <option value="1"
                            <c:if test="${item.status != 0}">selected="selected"</c:if>>产生活动</option>
                        <option value="0"
                            <c:if test="${item.status == 0}">selected="selected"</c:if>>停止产生活动</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td>接收动态的用户</td>
                <td><input type="checkbox" value="1" name="defaultReceivers"
                    <c:if test="${paasfn:bitAnd(item.defaultReceiver,1) ==1}">checked</c:if> />参数提供
                    <input type="checkbox" value="2" name="defaultReceivers"
                    <c:if test="${paasfn:bitAnd(item.defaultReceiver,2) ==2}">checked</c:if> />自己
                    <input type="checkbox" value="4" name="defaultReceivers"
                    <c:if test="${paasfn:bitAnd(item.defaultReceiver,4) ==4}">checked</c:if> />通讯录中的人
                </td>
            </tr>
            <tr>
                <td>其他通知方式(暂不提供功能)</td>
                <td><input type="checkbox" value="1" name="noticeChannels"
                    <c:if test="${paasfn:bitAnd(item.noticeChannel,1) ==1}">checked</c:if> />email
                    <input type="checkbox" value="2" name="noticeChannels"
                    <c:if test="${paasfn:bitAnd(item.noticeChannel,2) ==2}">checked</c:if> />短信
                </td>
            </tr>
            <tr>
                <td>模板测试数据<br>json格式的<br>Activity
                </td>
                <td><textarea rows="5" cols="60" name="testActivityJson">${item.testActivityJson}</textarea>
                </td>
            </tr>
            <tr>
                <td>动态模板</td>
                <td><textarea rows="5" cols="60" name="template">${item.template}</textarea>
                    <div id="templateTestResult"></div>
                    <div id="viewHtml" style="display: none; text-align: right">
                        <a href="javascript:alert($('#templateTestResult').html() )">查看源码</a>
                    </div></td>
            </tr>
            <tr>
                <td></td>
                <td><input type="checkbox" name="update" value="1"
                    <c:if test="${item.type > 0}">checked</c:if>>修改 <input
                    type="button" value="模版测试" onclick="javascript:testTemplate();" />
                    <input type="button" value="提交"
                    onclick="javascript:addActivityDefinition();" /> <input
                    type="button" value="取消"
                    onclick="javascript:cleanHtml('div-showActivityDefinition-form');" />
                </td>
            </tr>
        </table>
    </form>
</div>

<script type="text/javascript">
if("${returnMsg}" != ""){
    alert("${returnMsg}");
}
</script>